package com.haoyeteng.sxbd.core.common.constant.factory;

import javax.servlet.http.HttpServletRequest;

import com.baomidou.mybatisplus.plugins.Page;
import com.haoyeteng.sxbd.core.support.HttpKit;

/**
 * BootStrap Table默认的分页参数创建
 *
 * @author haoyeteng
 * @date 2017-04-05 22:25
 */
public class PageFactory<T> {

    public Page<T> defaultPage() {
        HttpServletRequest request = HttpKit.getRequest();
        int limit =Integer.valueOf(request.getParameter("limit"));    //每页多少条数据
        int pageNo = Integer.valueOf(request.getParameter("page"));   //每页的偏移量(本页当前有多少条)
        Page<T> page = new Page<>(pageNo, limit);
        return page;
    }
}
